package com.bbm.controller;


import com.bbm.entity.HouseImg;
import com.bbm.entity.vo.ResponseResult;
import com.bbm.service.HouseImgService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (HouseImg)表控制层
 *
 * @author lionkliu
 * @since 2024-02-18 18:04:10
 */
@RestController
@RequestMapping("houseImg")
public class HouseImgController {

    @Resource
    private HouseImgService houseImgService;

    @GetMapping("/{id}")
    public ResponseResult getImagesByHouse(@PathVariable Integer id) {
        return houseImgService.getImgListById(id);
    }

    @PostMapping
    public ResponseResult insert(@RequestBody HouseImg houseImg) {
        return houseImgService.insertOne(houseImg);
    }

    @PutMapping
    public ResponseResult update(@RequestBody HouseImg houseImg) {
        return houseImgService.updateOne(houseImg);
    }

    @DeleteMapping("/{id}")
    public ResponseResult delete(@PathVariable Integer id) {
        return houseImgService.deleteById(id);
    }

}
